package com.danskin.wechat.service.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.danskin.wechat.dao.WxMenuClickDao;
import com.danskin.wechat.service.WxMenuClickService;
import com.danskin.wechat.util.LogUtil;
import com.danskin.wechat.util.Page;
import com.danskin.wechat.vo.WxMenuClickDetailVo;
import com.danskin.wechat.vo.WxMenuClickVo;

@Service
public class WxMenuClickServiceImpl implements WxMenuClickService{
	
	@Autowired
	private WxMenuClickDao wxMenuClickDao;

	@Override
	public WxMenuClickVo selectWxMenuClickVoList(Map map) {
		LogUtil.info("=======根据时间查询菜单点击统计参数："+ToStringBuilder.reflectionToString(map));
		
		WxMenuClickVo menuClick = new WxMenuClickVo();
		
		try {
			menuClick = wxMenuClickDao.selectWxMenuClickVoList(map);
		} catch (Exception e) {
			LogUtil.error("========根据时间查询菜单点击统计异常", e);
		}
		return menuClick;
	}

	@Override
	public List<WxMenuClickDetailVo> listPageWxMenuClickDetailVoList(Page page) {
		LogUtil.info("=======根据时间查询菜单点击详情参数："+ToStringBuilder.reflectionToString(page));
		
		List<WxMenuClickDetailVo> menuClickDetailList = new ArrayList<WxMenuClickDetailVo>();
		
		try {
			menuClickDetailList = wxMenuClickDao.listPageWxMenuClickDetailVoList(page);
		} catch (Exception e) {
			LogUtil.error("========根据时间查询菜单点击详情异常", e);
		}
		return menuClickDetailList;
	}

	@Override
	public List<WxMenuClickDetailVo> selectWxMenuClickDetailVoList(Map map) {
		LogUtil.info("=======根据时间查询菜单点击详情（用于导出）参数："+ToStringBuilder.reflectionToString(map));
		
		List<WxMenuClickDetailVo> menuClickDetailList = new ArrayList<WxMenuClickDetailVo>();
		
		try {
			menuClickDetailList = wxMenuClickDao.selectWxMenuClickDetailVoList(map);
		} catch (Exception e) {
			LogUtil.error("========根据时间查询菜单点击详情（用于导出）异常", e);
		}
		return menuClickDetailList;
	}

}
